package top.whysu.study.thinkinjava.chapter8.polymorphism.example2;

import java.util.Random;

/**
 * @description
 * @date 2021-07-19 15:06
 */
public class RandomShapeGenerator {
    private Random random = new Random(47);
    public Shape next() {
        switch (random.nextInt(3)) {
            case 0:
                return new Circle();
            case 1:
                return new Square();
            case 2:
                return new Triangle();
            default:
                return null;
        }
    }
}